<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>AI艺术照</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
        }
        
        :root {
            --primary: #4361ee;
            --primary-dark: #3a56d4;
            --secondary: #ff6b6b;
            --light: #f8f9fa;
            --dark: #343a40;
            --gray: #6c757d;
            --border: #e9ecef;
            --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
            --transition: all 0.3s ease;
        }
        
        body {
            background-color: #f5f7ff;
            color: #333;
            line-height: 1.6;
            padding-bottom: 30px;
        }
        
        h1 {
            font-size: 1.4rem;
            font-weight: 700;
            margin-bottom: 4px;
            text-shadow: 0 1px 3px rgba(0,0,0,0.2);
        }
        
        .categories-container {
            background-color: white;
            z-index: 900;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            border-bottom: 1px solid var(--border);
            padding: 0 5px;
        }
        
        .categories {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 20px 5px;
            overflow-x: auto;
            padding: 12px 5px;
            -ms-overflow-style: none;
            scrollbar-width: none;
            max-width: 1200px;
            margin: 0 auto;
        }
        
        .categories::-webkit-scrollbar {
            display: none;
        }
        
        .category {
            padding: 8px 0px;
            text-align: center;
            border-radius: 30px;
            font-size: 0.8rem;
            white-space: nowrap;
            background-color: #f0f2f5;
            color: #555;
            cursor: pointer;
            transition: var(--transition);
            flex-shrink: 0;
            font-weight: 500;
        }
        
        .category.active {
            background: linear-gradient(to right, #6a11cb, #2575fc);
            color: white;
            font-weight: 600;
            box-shadow: 0 4px 8px rgba(67, 97, 238, 0.3);
        }
        
        .content {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px 12px;
        }
        
        .cards-container {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 15px;
        }
        
        .card {
            background: white;
            border-radius: 14px;
            overflow: hidden;
            box-shadow: var(--card-shadow);
            transition: var(--transition);
            position: relative;
        }
        
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
        }
        
        .card-image-container {
            position: relative;
            width: 100%;
            padding-top: 133.33%; /* 3:4 比例 */
            overflow: hidden;
            background: linear-gradient(45deg, #f8f9fa, #e9ecef);
        }
        
        .card-image {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #adb5bd;
            font-size: 14px;
            transition: var(--transition);
        }
        
        .card-image.loading {
            background: linear-gradient(-45deg, #f0f2f5, #e6e9ed, #f0f2f5, #e6e9ed);
            background-size: 400% 400%;
            animation: gradientLoading 1.5s ease infinite;
        }
        
        @keyframes gradientLoading {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }
        
        .card-title {
            padding: 14px 8px;
            text-align: center;
            font-size: 0.95rem;
            font-weight: 600;
            color: var(--dark);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            background: white;
        }
        
        .category-section {
            display: none;
            animation: fadeIn 0.5s ease;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .category-section.active {
            display: block;
        }
        
        .section-title {
            font-size: 1.3rem;
            font-weight: 700;
            margin: 10px 0 20px 0;
            color: var(--dark);
            position: relative;
            padding-left: 15px;
            display: flex;
            align-items: center;
        }
        
        .section-title::before {
            content: "";
            position: absolute;
            left: 0;
            top: 5px;
            height: 22px;
            width: 5px;
            background: linear-gradient(to bottom, var(--primary), #4cc9f0);
            border-radius: 3px;
        }
        
        .no-results {
            grid-column: span 2;
            text-align: center;
            padding: 40px 20px;
            color: var(--gray);
            font-size: 1rem;
        }
        
        .no-results i {
            font-size: 2.5rem;
            margin-bottom: 15px;
            color: #dee2e6;
        }
        
        /* 大图查看模态框 */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.9);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 2000;
            opacity: 0;
            visibility: hidden;
            transition: var(--transition);
        }
        
        .modal-overlay.active {
            opacity: 1;
            visibility: visible;
        }
        
        .modal-content {
            position: relative;
            max-width: 90%;
            max-height: 90%;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        
        .modal-image {
            max-width: 100%;
            max-height: 80vh;
            object-fit: contain;
            border-radius: 8px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
        }
        
        .modal-title {
            color: white;
            font-size: 1.2rem;
            margin-top: 15px;
            text-align: center;
            max-width: 90%;
        }
        
        .modal-close {
            position: absolute;
            top: -45px;
            right: 0;
            color: white;
            font-size: 2rem;
            cursor: pointer;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 50%;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .modal-nav {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            width: 100%;
            display: flex;
            justify-content: space-between;
            padding: 0 20px;
        }
        
        .nav-btn {
            color: white;
            background: rgba(0, 0, 0, 0.4);
            border-radius: 20%;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            cursor: pointer;
            transition: var(--transition);
        }
        
        .nav-btn:hover {
            background: rgba(0, 0, 0, 0.3);
            transform: scale(1.1);
        }
        
        .footer {
            text-align: center;
            padding: 25px 20px 15px;
            color: var(--gray);
            font-size: 0.85rem;
            max-width: 1200px;
            margin: 20px auto 0;
            border-top: 1px solid var(--border);
        }
        
        .footer p {
            margin: 5px 0;
        }
    
        
        /* 响应式设计 */
        @media (min-width: 576px) {
            .cards-container {
                gap: 20px;
            }
            
            .categories {
                padding: 12px 15px;
            }
            
            .category {
                padding: 8px 22px;
                margin: 0 8px;
                font-size: 0.95rem;
            }
            
            h1 {
                font-size: 1.6rem;
            }
        }
        
        @media (min-width: 768px) {            
            .cards-container {
                grid-template-columns: repeat(3, 1fr);
            }
            
            .content {
                padding: 25px 20px;
            }
            
            .section-title {
                font-size: 1.5rem;
                margin: 15px 0 25px 0;
            }
        }
        
        @media (min-width: 992px) {
            .cards-container {
                grid-template-columns: repeat(4, 1fr);
            }
            
            .categories {
                justify-content: center;
            }
        }
    </style>
</head>
<body>    
    <!-- 分类栏容器 -->
    <div class="categories-container">
        <div class="categories" id="categoriesList"></div>
    </div>
    
    <!-- 内容区域 -->
    <div class="content" id="contentSections"></div>
    
    <!-- 大图查看模态框 -->
    <div class="modal-overlay" id="imageModal">
        <div class="modal-content">
            <span class="modal-close" id="closeModal">&times;</span>
            <img class="modal-image" id="modalImage" src="" alt="大图预览">
            <div class="modal-title" id="modalTitle"></div>
            <div class="modal-nav">
                <div class="nav-btn prev-btn" id="prevImage">
                    <i class="fas fa-chevron-left"></i>
                </div>
                <div class="nav-btn next-btn" id="nextImage">
                    <i class="fas fa-chevron-right"></i>
                </div>
            </div>
        </div>
    </div>

    <script>
        // 分类配置数据 - 在这里修改分类名称
        const categoriesConfig = [
            { id: "home", name: "首页" },
            { id: "anime", name: "1.动漫头像" },
            { id: "animal", name: "2.动物朋友" },
            // { id: "science", name: "2.科幻世界" },
            // { id: "superman", name: "3.超级英雄" },
            // { id: "fairy", name: "4.童话世界" },
            // { id: "ancient", name: "5.穿越古代" },
            // { id: "job", name: "6.职业萌想" },
            // { id: "nation", name: "7.国风美人" },
            // { id: "impasto", name: "8.厚涂插画" },
            // { id: "idphoto", name: "9.证件照" },
            // { id: "portrait", name: "10.写真照" },
            // { id: "group", name: "11.情侣合照" },
            // { id: "festival", name: "12.节日主题" },
            { id: "style", name: "13.风格变换" }
        ];
        
        // 卡片数据
        const cardsData = {
            home: [
                { title: '简介' },
                { title: '下单流程' },
                { title: '微信二维码' }
            ],
            anime: [
                { title: '101' },
                { title: '102' },
                { title: '103' },
                { title: '104' },
                { title: '105' },
                { title: '106' },
                { title: '107' },
            ],
            animal: [
                { title: '201' },
                { title: '202' },
                { title: '203' },
                { title: '204' },
                { title: '205' },
                { title: '206' },
                { title: '207' },
                { title: '208' },
                { title: '209' }
            ],
            // science: [
            //     { title: '201' },
            //     { title: '202' },
            //     { title: '203' },
            //     { title: '204' },
            //     { title: '205' }
            // ],
            // superman: [
            //     { title: '301' },
            //     { title: '302' },
            //     { title: '303' },
            //     { title: '304' },
            //     { title: '305' },
            //     { title: '306' },
            //     { title: '307' },
            //     { title: '308' },
            //     { title: '309' }
            // ],
            // fairy: [
            //     { title: '401' },
            //     { title: '402' },
            //     { title: '403' },
            //     { title: '404' },
            //     { title: '405' },
            //     { title: '406' },
            //     { title: '407' },
            //     { title: '408' }
            // ],
            // ancient: [
            //     { title: '501' },
            //     { title: '502' },
            //     { title: '503' },
            //     { title: '504' }
            // ],
            // job: [
            //     { title: '601' },
            //     { title: '602' },
            //     { title: '603' },
            //     { title: '604' },
            //     { title: '605' }
            // ],
            // nation: [
            //     { title: '701' },
            //     { title: '702' },
            //     { title: '703' },
            //     { title: '704' },
            //     { title: '705' },
            //     { title: '706' },
            //     { title: '707' },
            //     { title: '708' }
            // ],
            // impasto: [
            //     { title: '801' },
            //     { title: '802' },
            //     { title: '803' },
            //     { title: '804' },
            //     { title: '805' },
            //     { title: '806' },
            //     { title: '807' },
            //     { title: '808' },
            //     { title: '809' },
            //     { title: '810' },
            //     { title: '811' },
            //     { title: '812' },
            //     { title: '813' },
            //     { title: '814' }
            // ],
            // idphoto: [
            //     { title: '901' },
            //     { title: '902' },
            //     { title: '903' },
            //     { title: '904' },
            //     { title: '905' },
            //     { title: '906' }
            // ],
            // portrait: [
            //     { title: '1001' },
            //     { title: '1002' },
            //     { title: '1003' },
            //     { title: '1004' },
            //     { title: '1005' },
            //     { title: '1006' },
            //     { title: '1007' },
            //     { title: '1008' },
            //     { title: '1009' },
            //     { title: '1010' },
            //     { title: '1011' },
            //     { title: '1012' },
            //     { title: '1013' },
            //     { title: '1014' },
            //     { title: '1015' },
            //     { title: '1016' }
            // ],
            // group: [
            //     { title: '1101' },
            //     { title: '1102' },
            //     { title: '1103' },
            //     { title: '1104' },
            //     { title: '1105' },
            //     { title: '1106' }
            // ],
            // festival: [
            //     { title: '1201' },
            //     { title: '1202' },
            //     { title: '1203' },
            //     { title: '1204' },
            //     { title: '1205' },
            //     { title: '1206' }
            // ],
            style: [
                { title: '这是原图' },
                { title: '1302 星蝶风' },
                { title: '1303 简约插画' },
                { title: '1304 莫奈花园' },
                { title: '1305 可爱动漫' },
                { title: '1306 漫画' },
                { title: '1307 简约卡通' },
                { title: '1308 扁平卡通' },
                { title: '1309 手绘插画' },
                { title: '1310 写实插画' },
                { title: '1311 3D卡通' },
                { title: '1312 素描' }
            ]
        };
        
        // 全局变量用于跟踪当前查看的图片
        let currentCategory = '';
        let currentIndex = 0;
        let currentImages = [];
        
        // 生成分类栏
        function generateCategories() {
            const categoriesList = document.getElementById('categoriesList');
            categoriesList.innerHTML = '';
            
            categoriesConfig.forEach((category, index) => {
                const categoryElement = document.createElement('div');
                categoryElement.className = index === 0 ? 'category active' : 'category';
                categoryElement.setAttribute('data-category', category.id);
                categoryElement.textContent = category.name;
                categoriesList.appendChild(categoryElement);
            });
        }
        
        // 生成内容区域
        function generateContentSections() {
            const contentSections = document.getElementById('contentSections');
            contentSections.innerHTML = '';
            
            categoriesConfig.forEach((category, index) => {
                const section = document.createElement('div');
                section.className = index === 0 ? 'category-section active' : 'category-section';
                section.id = category.id;
                
                section.innerHTML = `
                    <h2 class="section-title">${category.name}</h2>
                    <div class="cards-container" id="${category.id}-cards"></div>
                `;
                
                contentSections.appendChild(section);
            });
        }
        
        // 生成卡片
        function generateCards() {
            for (const category in cardsData) {
                const container = document.getElementById(`${category}-cards`);
                if (!container) continue;
                
                container.innerHTML = '';
                
                if (cardsData[category].length === 0) {
                    container.innerHTML = `
                        <div class="no-results">
                            <i class="far fa-folder-open"></i>
                            <p>该分类下暂无内容</p>
                        </div>
                    `;
                    continue;
                }
                
                cardsData[category].forEach((card, index) => {
                    const cardElement = document.createElement('div');
                    cardElement.className = 'card';
                    
                    const imgPath = `./images/${category}/${category}-${index + 1}.jpg`;
                    
                    cardElement.innerHTML = `
                        <div class="card-image-container">
                            <div class="card-image loading" id="img-${category}-${index}">
                                <i class="fas fa-spinner fa-spin"></i>
                            </div>
                        </div>
                        <div class="card-title">${card.title}</div>
                    `;
                    container.appendChild(cardElement);
                    
                    loadImage(imgPath, `img-${category}-${index}`);
                    
                    const imageContainer = cardElement.querySelector('.card-image-container');
                    imageContainer.addEventListener('click', () => {
                        openModal(category, index);
                    });
                });
            }
        }
        
        // 图片加载函数（带错误处理）
        function loadImage(src, elementId) {
            const imgContainer = document.getElementById(elementId);
            if (!imgContainer) return;
            
            const testImage = new Image();
            testImage.onload = function() {
                imgContainer.innerHTML = '';
                imgContainer.classList.remove('loading');
                imgContainer.style.backgroundImage = `url('${src}')`;
                imgContainer.style.backgroundSize = 'cover';
                imgContainer.style.backgroundPosition = 'center';
            };
            testImage.onerror = function() {
                imgContainer.innerHTML = '';
                imgContainer.classList.remove('loading');
                imgContainer.style.backgroundImage = `url('./images/default.jpg')`;
                imgContainer.style.backgroundSize = 'cover';
                imgContainer.style.backgroundPosition = 'center';
            };
            testImage.src = src;
        }
        
        // 切换分类
        function switchCategory(categoryId) {
            document.querySelectorAll('.category').forEach(btn => {
                btn.classList.remove('active');
            });
            document.querySelector(`.category[data-category="${categoryId}"]`).classList.add('active');
            
            document.querySelectorAll('.category-section').forEach(section => {
                section.classList.remove('active');
            });
            document.getElementById(categoryId).classList.add('active');
            
            window.scrollTo({ top: 0, behavior: 'smooth' });
        }

        // 打开大图模态框
        function openModal(category, index) {
            currentCategory = category;
            currentIndex = index;
            currentImages = cardsData[category];
            
            const modal = document.getElementById('imageModal');
            const modalImage = document.getElementById('modalImage');
            const modalTitle = document.getElementById('modalTitle');
            
            const imgPath = `./images/${category}/${category}-${index + 1}.jpg`;
            modalImage.src = imgPath;
            modalTitle.textContent = cardsData[category][index].title;
            
            modal.classList.add('active');
            document.body.style.overflow = 'hidden';
        }
        
        // 关闭大图模态框
        function closeModal() {
            const modal = document.getElementById('imageModal');
            modal.classList.remove('active');
            document.body.style.overflow = '';
        }
        
        // 导航到上一张图片
        function prevImage() {
            if (currentIndex > 0) {
                currentIndex--;
                openModal(currentCategory, currentIndex);
            }
        }
        
        // 导航到下一张图片
        function nextImage() {
            if (currentIndex < currentImages.length - 1) {
                currentIndex++;
                openModal(currentCategory, currentIndex);
            }
        }
        
        // 键盘事件处理
        function handleKeyDown(e) {
            if (document.getElementById('imageModal').classList.contains('active')) {
                if (e.key === 'Escape') {
                    closeModal();
                } else if (e.key === 'ArrowLeft') {
                    prevImage();
                } else if (e.key === 'ArrowRight') {
                    nextImage();
                }
            }
        }
        
        // 初始化页面
        document.addEventListener('DOMContentLoaded', () => {
            // 生成分类栏和内容区域
            generateCategories();
            generateContentSections();
            
            // 生成卡片
            generateCards();
            
            // 添加分类点击事件
            document.querySelectorAll('.category').forEach(btn => {
                btn.addEventListener('click', () => {
                    const categoryId = btn.getAttribute('data-category');
                    switchCategory(categoryId);
                });
            });

            // 模态框事件
            document.getElementById('closeModal').addEventListener('click', closeModal);
            document.getElementById('prevImage').addEventListener('click', prevImage);
            document.getElementById('nextImage').addEventListener('click', nextImage);
            
            // 点击模态框背景关闭
            document.getElementById('imageModal').addEventListener('click', (e) => {
                if (e.target === document.getElementById('imageModal')) {
                    closeModal();
                }
            });
            
            // 键盘事件
            document.addEventListener('keydown', handleKeyDown);
        });
    </script>
</body>
</html>